ngl: clear Glyph front cache at the beginning of a frame
authorChristian Hergert <chergert@redhat.com>
Fri, 19 Mar 2021 00:54:48 +0000 (17:54 -0700)
committerChristian Hergert <chergert@redhat.com>
Fri, 19 Mar 2021 01:00:04 +0000 (18:00 -0700)
We don't want to be responsible for duplicating the effort of the hash
table, we just want to speed up subsequent lookups. Otherwise, we risk
not marking glyph usage when tracking usage for compaction.

gsk/ngl/gsknglglyphlibrary.c

index 5cb2a3fe3b2a4db27c93ff0479698505db22d914..bc57475c001b730e253f03d4db319974399dc00e 100644 (file)
@@ -83,6 +83,16 @@ gsk_ngl_glyph_value_free (gpointer data)
   g_slice_free (GskNglGlyphValue, data);
 }
 
+static void
+gsk_ngl_glyph_library_begin_frame (GskNglTextureLibrary *library,
+                                   gint64                frame_id,
+                                   GPtrArray            *removed_atlases)
+{
+  GskNglGlyphLibrary *self = GSK_NGL_GLYPH_LIBRARY (library);
+
+  memset (self->front, 0, sizeof self->front);
+}
+
 static void
 gsk_ngl_glyph_library_finalize (GObject *object)
 {
@@ -98,8 +108,11 @@ static void
 gsk_ngl_glyph_library_class_init (GskNglGlyphLibraryClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GskNglTextureLibraryClass *library_class = GSK_NGL_TEXTURE_LIBRARY_CLASS (klass);
 
   object_class->finalize = gsk_ngl_glyph_library_finalize;
+
+  library_class->begin_frame = gsk_ngl_glyph_library_begin_frame;
 }
 
 static void